<template>
	<section class="danping">
		 <el-tabs v-model="activeName" @tab-click="handleClick">
		    <el-tab-pane label="业务协同考核" name="four">
		    	<tong-ji-left-tab 
		    		@submitFrom="submitFrom" @gotoPage="gotoPage" 
		    		@chooseBran="chooseBran"
		    		:lableData="lableData" :params='params'
		    		:tableData ='tableData' :activeName="activeName" 
		    		:total="total" :treeData="treeData">
		    	</tong-ji-left-tab>
		    </el-tab-pane>
		    <el-tab-pane label="业务分发考核" name="five">
		    	<tong-ji-left-tab
		    		 @submitFrom="submitFrom" @gotoPage="gotoPage" 
		    		 @chooseBran = "chooseBran"  :params='params'
		    		:lableData="lableData" :tableData ='tableData' 
		    		:activeName="activeName" :total="total" 
		    		:treeData="treeData">
		    	</tong-ji-left-tab>
		    </el-tab-pane>
		  </el-tabs>
	</section>
</template>

<script>
	import tongJiLeftTab from '../components/tongJiLeftTab';
	import {apiGetList,getree} from '../css_img_js/apiTongJi'
	export default{
		props:{
			
		},
		components:{
			tongJiLeftTab,
		},
		data(){
			return{
				activeName:'four',
				params:{
					groupByType:'3',
					orgSerialNo:'',
					roleTypeOfCase:'1',
					yearId:'',
					quarterId:'',
					monthId:'',
				},
				treeData:[],
				lableData:{},
				tableData:[
					{
					}
				],
				total:'',
				fourLable:{
				        username : '人员名称',
				        orgName : '所属单位',
				        caseFeedbackAmount : '案件反馈量',
				        caseAcceptAmount : '案件受理量',
				        caseFeedbackAmountRatio : '案件反馈率',
				        caseAcceptAmountOntime:'按时受理量',
				        caseFeedbackAmountOntime: '按时反馈量',
				        caseAcceptAmountDelayed : '延迟受理量',
				        commentSponsorSynergismPoliceAmount : '发起民警评分',
				        commentDistributeOrgAmount : '分发部门评分',
//				        acountAll:'总分'
				},
				fiveLable:{
				        username : '人员名称',
				        orgName : '所属单位',
				        caseFeedbackAmount : '案件反馈量',
				        caseAcceptAmount : '案件受理量',
				        caseFeedbackAmountRatio : '案件反馈率',
				        caseAcceptAmountOntime:'按时受理量',
				        caseFeedbackAmountOntime : '按时反馈量',
				        caseDistributeAmountOntime : '按时分发量',
				        caseDistributeAmountDelayed : '延时分发量',
				        caseFeedbackAmountDelayed : '延迟反馈量',
				        commentSponsorSynergismPoliceAmount:'发起协同民警评分',
				        commentAcceptBusinessSynergismOrgAmount:'受理业务部门评分',
//				        acountAll:'总分'
				},
			}
		},
		methods:{
			handleClick(tab){
				this.changeLable(tab.name);
			},
			changeLable(val){
		      	if(val==='four'){
		      		this.params.roleTypeOfCase="1";
		      		this.lableData = this.fourLable;
		      		this.getList();
		      	}else if(val==='five'){
		      		this.params.roleTypeOfCase="2";
		      		this.lableData = this.fiveLable;
		      		this.getList();
		      	}
	     	},
	     	getList(){/*获取列表*/
	     		apiGetList(this,this.params)
	     	},
	     	gotoPage(val){/*分页*/
	     		console.log(val);
	     	},
	     	submitFrom(val){/*查询条件*/
	     		console.log(val);
	     		this.params.groupByType = val.form2.groupByType;
	     		this.params.monthId = val.form2.monthId;
	     		this.params.quarterId = val.form2.quarterId;
	     		this.params.yearId = val.form2.yearId;
	     		this.getList();
	     	},
	     	geTree(){/*获取左侧树状结构*/
	     		getree().then((res)=>{
	     			console.log(res);
	     			this.treeData=res.data.data;
	     			console.log(this.treeData);
	     		})
	     	},
	     	chooseBran(val){
	     		this.params.orgSerialNo=val.orgSerialNo;
	     		this.getList();
	     	}
		},
		mounted(){
	    	this.changeLable('four');
	    	this.getList();
	    	this.geTree();
	    }
	}
</script>

<style>
.danping .el-tree-node__content{
	height: unset;
}

.danping .el-tree-node__label {
    font-size: 14px;
    width: 158px;
    word-wrap: break-word;
    white-space: initial;
    /* height: 50px !important; */
    margin: 5px 0;
}
</style>